package cn.bdqn.controller;

import cn.bdqn.domain.Nurse;
import cn.bdqn.service.NurseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/SYS/nurse")
public class NurseController {

    @Autowired
    private NurseService nurseService;

    /**
     * 根据id删除医生信息
     * @param id 需要删除的护士id
     * @return 是否成功
     */
    @GetMapping("/deleteByid")
    public int deleteNurseInfomationByid(Integer id) {return nurseService.takeOffNurseInformationByid(id); }

    /**
     *新增护士全部信息
     * @param record 需要添加的护士信息
     * @return 是否成功
     */
    @GetMapping("/insert")
    public int insertNurseInformation(Nurse record) { return nurseService.addNurseInformation(record); }

    /**
     * 新增护士部分信息
     * @param record 需要添加的护士信息
     * @return 是否成功
     */
    @GetMapping("/insertSelective")
    public int insertNurseInformationSelective(Nurse record) { return nurseService.addNurseInformationSelective(record); }

    /**
     * 根据id查询护士信息
     * @param id 需要查询的护士id
     * @return 查询出来的护士信息
     */
    @GetMapping("/selectByid")
    public Nurse selectNurseInformationByid(Integer id) { return nurseService.queryNurseInformationByid(id); }

    /**
     * 修改护士全部信息
     * @param record 需要修改的护士信息
     * @return 是否成功
     */
    @GetMapping("/update")
    public int updateNurseInformation(Nurse record) { return nurseService.changeNurseInformation(record); }

    /**
     * 修改护士部分信息
     * @param record 需要修改的护士信息
     * @return 是否成功
     */
    @GetMapping("/updateSelective")
    public int updateNurseInformationSelective(Nurse record) { return nurseService.changeNurseInformaitonBySelective(record); }


}
